﻿function StaffTimeTestEditController($scope, service, $routeParams, $location, $http) {

    $http.get("api/StaffTest/", {})
        .success(function(data) {
            $scope.rowsData = data;
        })
        .error(function(err) {

            console.log("error", err);
        });
    // update function
    $scope.update = function() {
        var StaffObj = {
            Id: $scope.Id,
            StaffId: $scope.StaffId,
            StampDate: $scope.StampDate,
            UpdateTime: $scope.UpdateTime,
            Remark: $scope.Remark,
            CheckIn: $scope.CheckIn,
            CheckOut: $scope.CheckOut,
            GoOut: $scope.GoOut,
            TurnBack: $scope.TurnBack,
            StartBreakTime: $scope.StartBreakTime,
            EndBreakTime: $scope.EndBreakTime,
            RowStatus: $scope.RowStatus
        };
        $http.put("api/StaffTest/", StaffObj)
            .success(function(data) {
                console.log("success", data);
                $scope.rowsData.push(data);
            })
            .error(function(err) {
                console.log("error", err);
            });
    }; //Select funtion

    //save function
    $scope.save = function() {
        var StaffObj = {
            StaffId: $scope.StaffId,
            StampDate: $scope.StampDate,
            UpdateTime: $scope.UpdateTime,
            Remark: $scope.Remark,
            CheckIn: $scope.CheckIn,
            CheckOut: $scope.CheckOut,
            GoOut: $scope.GoOut,
            TurnBack: $scope.TurnBack,
            StartBreakTime: $scope.StartBreakTime,
            EndBreakTime: $scope.EndBreakTime,
            RowStatus: $scope.RowStatus
        };
        $http.post("api/StaffTest/", StaffObj)
            .success(function(data) {
                console.log("success", data); //$scope.rowsData.push(data);
            })
            .error(function(err) {
                console.log("error", err);
            });
    };
}